<!--
Author: Atef Sami
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=9" />
        <link href="style3.css" rel="stylesheet" type="text/css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <!-- created a table in order to retrieve the data from the session  table in the database and to show it in order in the made table on the webpage -->
        <h1><?php
include "functions.php";
echo get_conference_name($_GET['conference_id']);
?></h1>
       <!-- h2 is to get ho many sessions is in this conference -->
        <h2 id="h2"></h2>
        <table border="1">
            <tr>
                <td>Session id</td><td>Date</td><td>List_of_papers</td>
            </tr>
            <?php
            
            include "statics.php";
            $rsResult = rsSelect("*", "session", array("conference_id=", $_GET['conference_id']));
            echo "<script>document.getElementById('h2').innerHTML='" . mysql_num_rows($rsResult) . " Session[s] Exist for this conference';</script>";
            echo "<tr>";
            $num = 1;
            // entering session information
            while ($row = mysql_fetch_assoc($rsResult)) 
            {
                echo "<td>" . $num++ . "</td><td>" . $row['session_date'] . "</td>";
                // getting all papers belonging to this conference and included in this session
                $rsPapers = rsSelect("*", "paper", array('conference_id=', $row['conference_id'], "AND", "session_id=", $row['session_id'])); 
                echo "<td><ul>";
                // iterate over the lis of papers and add an anchor for each that redirects to a page where you can view he pdf
                while ($rowPapers = mysql_fetch_assoc($rsPapers)) 
                {
                    echo "<li><a target='_blank' href='viewPdf.php?paper_id=" . $rowPapers['paper_id'] . "'>" . $rowPapers['paper_title'] . "</a></li>";
                }
                echo "</ul></td></tr>";
            }
            // End of documentation
            ?>
        </table>
    </body>
</html>
